<?php
require 'config.php';

try {
    $stmt = $pdo->query("SELECT * FROM licenses");
    $licenses = $stmt->fetchAll(PDO::FETCH_ASSOC);

    echo "<h1>许可证列表</h1>";
    echo "<table border='1' cellpadding='5' cellspacing='0'>";
    echo "<tr><th>License Key</th><th>Max Users</th><th>Current Users</th></tr>";

    foreach ($licenses as $license) {
        echo "<tr>";
        echo "<td>" . htmlspecialchars($license['license_key']) . "</td>";
        echo "<td>" . htmlspecialchars($license['max_users']) . "</td>";
        echo "<td>" . htmlspecialchars($license['current_users']) . "</td>";
        echo "</tr>";
    }

    echo "</table>";
} catch (PDOException $e) {
    echo "查询失败: " . $e->getMessage();
}
?>
